function followUser(params,suc) {
	var url = "../followAjax/addFollow.action";
	doAjax(url, params, suc);
}
function unFollowUser(params,suc) {
	var url = "../followAjax/deleteFollow.action";
	doAjax(url, params, suc);
}

function follow(){
	var user = $(this);
	var params = {
			"query.followId" : $("#container").attr("userid")
		};
	followUser(params, function(ajaxResult) {
		if (ajaxResult.OK) {
			user.html("取消关注");
			user.unbind().click(unFollow);
		}
	})
}

function unFollow(){
	var user = $(this);
	var params = {
			"query.followId" : $("#container").attr("userid")
		};
	unFollowUser(params, function(ajaxResult) {
		if (ajaxResult.OK) {
			user.html("关注");
			user.unbind().click(follow);
		}
	})
}

function regFollows(){
	$(".friList .followPeople").click(regFollow);
	$(".friList .following").click(regUnFollow);
}
function regFollow() {
	var user = $(this);
	var params = {
		"query.followId" : user.parents("dl").attr("userid")
	};
	followUser(params, function(ajaxResult) {
				if (ajaxResult.OK) {
					user.html("取消关注");
					user.unbind().click(regUnFollow);
				}
			})
}
function regUnFollow() {
	var user = $(this);
	var params = {
		"query.followId" : user.parents("dl").attr("userid")
	};
	unFollowUser(params, function(ajaxResult) {
				if (ajaxResult.OK) {
					user.html("关注");
					user.unbind().click(regFollow);
				}
			})
}
function personalPageAddFollow(){
	var userid=$("#myId").val();
	var params = {
			"query.followId" : userid
		};
		followUser(params, function(ajaxResult) {
					if (ajaxResult.OK) {
						user.html("取消关注");
					}
				})
}
function personalPageCancleFollow(){
	var userid=$("#myId").val();
	var params = {
			"query.followId" : userid
		};
		unFollowUser(params, function(ajaxResult) {
					if (ajaxResult.OK) {
						user.html("关注");
						
					}
				})
}